package com.polaris.live.dialog

import android.content.Context
import com.blankj.utilcode.util.StringUtils
import com.lxj.xpopup.core.CenterPopupView
import com.polaris.live.R
import com.polaris.live.common.ext.setOnSingleClickListener
import com.polaris.live.databinding.DialogBlockBinding
import com.polaris.live.translation.R.string

/**
 * 拉黑弹窗
 *
 * @author Created by 半仙 on 2023/9/4/004 12:58
 */
class BlockDialog(
    context: Context,
    private val isOKBlock: (() -> Unit),
    private val nickname: String
) : CenterPopupView(context) {

    private lateinit var mBinding: DialogBlockBinding

    override fun getImplLayoutId(): Int {
        return R.layout.dialog_block
    }

    override fun onCreate() {
        super.onCreate()
        mBinding = DialogBlockBinding.bind(popupImplView)

        mBinding.blockDetail.text = StringUtils.getString(string.is_sure_block, nickname)

        mBinding.isok.setOnSingleClickListener {
            isOKBlock.invoke()
            dismiss()
        }
        mBinding.cancel.setOnSingleClickListener {
            dismiss()
        }
    }
}